package com.myjavalab.sort;

import com.myjavalab.util.DataUtil;
import com.myjavalab.util.PrintUtil;

public class InsertSort {

	public static void sort(int[] ary, int start, int end){
		PrintUtil.prt(ary);
		for(int i = start+1; i <= end; i++) {
			int cur = ary[i];
			int j = i-1;
			while(j >= start && ary[j] > cur) {
				ary[j+1] = ary[j];
				j--;
			}
			ary[j+1] = cur;
			PrintUtil.prt(ary);
		}
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int[] ary = DataUtil.getNumber(100, 10);		
		sort(ary, 0, ary.length-1);
	}


}
